<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>HDCMS永久免费 - by HDCMS</title>
    <script src="{{__PUBLIC__}}/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" href="{{__PUBLIC__}}/hdjs/hdjs.css"/>
    <script type="text/javascript" src="{{__PUBLIC__}}/hdjs/hdjs.min.js"></script>
    {{bootstrap}}
    {{css file="__VIEW__/common.css"}}
</head>
<body>

<div class="hd-menu-list">
    <ul>
        <li class="active"><a href="#">栏目列表</a></li>
        <li><a href="{{U('add')}}">添加栏目</a></li>

    </ul>
</div>

<table class="hd-table hd-table-list">
    <thead>
    <tr>
        <td class='hd-w100'>ID</td>
        <td>菜单名称</td>
        <td>操作</td>
    </tr>
    </thead>
    <tbody>
    <?php foreach ($data as $field) {?>
       <tr>
        <td>{{$field['id']}}</td>
        <td>
            {{$field['_name']}}
        </td>
        <td class="hd-w150">
            <a href="{{U('edit',array('id'=>$field['id']))}}">修改</a> |
            <a href="{{U('add',array('pid'=>$field['id']))}}">添加子栏目</a> |
            <a id="del" href="javascript:del({{$field['id']}})">删除</a>
        </td>
    </tr> 
    <?php } ?>
    
    </tbody>
    
</table>

<div class="hd-menu-list">
    <ul>
        <!--<li class="active"><a href="javascript:delmenu()">删除菜单</a></li>
        <li class="active"><a href="javascript:query()">查询菜单</a></li>-->
        <li class="active"><a href="javascript:create()">创建菜单</a></li>

    </ul>
</div>
<script type="text/javascript">
		$(function(){

			$("body").delegate('.active',"click",function(){
				
				var media_id= $(this).find('[name=media_id]').val();
				var postData={
					'media_id':media_id,
					'keyword':$(this).find('[name=keyword]').val()
				};
				$.post("{{U('menu')}}",postData,function(data){
						hd_alert({
							message: data.message,
							timeout: 3,
						});

				},'json');
			});
		})
		
	</script>
	<script type="text/javascript">
	
	function del(id)
    {
        if(confirm('确定删除吗？'))
        {
        		var postData = {
        			'id':id
        		}
				$.post("{{U('del')}}",postData,function(data){

						hd_alert({
							message: data.message,
							timeout: 3,
						});

				},'json');
				window.location.reload(true);
        }
    }
		
	</script>
	
	<script type="text/javascript">
	
	function create()
    {
				$.post("{{U('menu')}}",function(data){

						hd_alert({
							message: data.message,
							timeout: 3,
						});

				},'json');
				
				return false;
  
    }
		
	</script>
	<script type="text/javascript">
	
	function delmenu()
    {
        if(confirm('确定删除吗？'))
        {
        		$.post("{{U('delmenu')}}",function(data){

						hd_alert({
							message: data.message,
							timeout: 3,
						});

				},'json');
        }
        return false;
    }
		
	</script>
	<!--<script type="text/javascript">
	
	function query()
    {
       
				$.post("{{U('query')}}",function(data){

						hd_alert({
							message: data.message,
							timeout: 3,
						});

				},'json');

        
    }
		
	</script>-->

</body>
</html>